home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / mint / lib / mntc6846.zoo / patch / dfltodf.s < prev    next >
Encoding:
Text File  |  1994-06-16  |  1.2 KB  |  41 lines

  1.  ! C68 32 bit integer => 8 byte-floating point conversion routine
  2.  !-----------------------------------------------------------------------------
  3.  ! ported to 68000 by Kai-Uwe Bloem, 12/89
  4.  !  #1  original author: Peter S. Housel 3/28/89
  5.  !  #2  Redid register usage, and then added wrapper routine
  6.  !    to provide C68 IEEE compatibility    Dave & Keith Walker    02/92
  7.  !  #3    Redid entry/exit points for C68 v4.3 compatibility
  8.  !    Removed ACK entry points                -djw-    09/93
  9.  !-----------------------------------------------------------------------------
  10.  
  11. BIAS8    =    0x3FF - 1
  12.  
  13.     .sect .text
  14.  
  15.     .define    .Xdfltodf
  16.  
  17. !----------------------------------------
  18. !    sp    Return address
  19. !    sp+4    value to convert
  20. !    sp+8    address of result
  21. !----------------------------------------
  22. .Xdfltodf:
  23.     move.l    4(sp),a1    ! return value address
  24.     lea    8(sp),a0    ! source address
  25.  
  26.     move.l    (a0),d1        ! get the 4-byte integer
  27.     move.w    #BIAS8+32-11,d0    ! radix point after 32 bits
  28.     move.w    (a0),d2        ! check sign of number
  29.     bge    1f        ! nonnegative
  30.     neg.l    d1        ! take absolute value
  31. 1:
  32.     clr.l    4(a1)        ! write mantissa onto stack
  33.     move.l    d1,(a1)
  34.     clr.w    d1        ! set rounding = 0
  35.     jsr    .Xnorm8
  36.  
  37.     move.l    (sp)+,a1    ! get return address
  38.     add.l    #8,sp        ! remove parameters from stack
  39.     jmp    (a1)        ! ... and return
  40.  
  41.